package com.gmail.huxiaowi.cblog.entity;

import java.io.Serializable;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

/**
 * Class Category
 * 
 *   类别POJO
 *   
 * @author  huxw
 * @version $Revision:1.0.0, $Date:2010-4-29 下午05:41:45$
 */
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
public class Category implements Serializable{
    private static final long serialVersionUID = 766661892457960825L;

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long id;
    
    @Persistent
    private String name;
    
    @Persistent
    private int articleCount;
    
    public Category() {
        super();
        // TODO Auto-generated constructor stub
    }

    public Category(String name) {
        super();
        this.name = name;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    
    public void addArticle(Article article) {
        article.setCategoryId(id);
    }

	public int getArticleCount() {
		return articleCount;
	}

	public void setArticleCount(int articleCount) {
		this.articleCount = articleCount;
	}
    
}
